﻿
namespace gbL.NetBoard.Filters
{
    /// <summary>
    /// Filters for an entry's tag being equal to the filter object
    /// </summary>
    public class TagFilter : IEntryFilter<object>
    {
        private ObjectEqualityFilter _innerFilter = new ObjectEqualityFilter();

        public void AddFilter(object owner, object toFilter)
        {
            _innerFilter.AddFilter(owner, toFilter);
        }

        public void Precalculate(IBlackboardEntry toTest)
        {
            // not needed
        }

        public bool HasFilter(object owner)
        {
            return _innerFilter.HasFilter(owner);
        }

        public bool IsAllowed(object owner, IBlackboardEntry toTest)
        {
            return _innerFilter.IsAllowed(owner, toTest.Tag);
        }
    }
}
